package com.app.art.controller.test;


import com.app.art.service.mq.MessageProducer;
import com.atom.module.common.result.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/rabbitmq")
@Tag(name = "测试：RabbitMQ")
public class RabbitMQController {

    @Autowired
    private MessageProducer producer;

    @GetMapping("/send/{message}")
    public Result<?> sendMessage(@PathVariable("message") String message) {
        producer.sendMessage(message);
        return Result.success();
    }

    @GetMapping("/sendack/{message}")
    public Result<?> sendMessageWithAck(@PathVariable("message") String message) {
        producer.sendMessageWithAck(message);
        return Result.success();
    }
}
